package ro.unibuc.nautilus.controllers.editors;

import java.beans.PropertyEditorSupport;

import org.springframework.beans.factory.annotation.Required;

import ro.unibuc.nautilus.service.ShipsService;

public class ShipPropertyEditor extends PropertyEditorSupport {
	private ShipsService shipsService;

	@Override
    public void setAsText(String text) throws IllegalArgumentException {
        Long shipId = new Long(text);
        setValue(shipsService.findShip(shipId));
    }
	
	@Required
	public void setShipsService(ShipsService shipsService) {
		this.shipsService = shipsService;
	}

}
